package org.jeecg.jt808.operate;


import org.jeecg.jt808.JTT808Encoder;
import org.jeecg.jt808.JTT808Message;
import org.jeecg.jt808.Jt808Control.Jt808CentralControlConfig;
import org.jeecg.jt808.modbus.ModbusParams;
import org.jeecg.jt808.processor.JT808MessageGenerator;
import org.jeecg.jt808.processor.MessageType;
import org.jeecg.jt808.vo.Packet;

import static org.jeecg.jt808.util.JT808Util.bytesToHexString;


public class QueryLocationMessage implements JT808MessageGenerator {
    @Override
    public String generateMessage(JTT808Message message) {

        //T8500 msg=new T8500();
        //msg.setProperties(0);
        //msg.setMessageId(33281);
        //msg.setEncryption(0);
        //msg.setReserved(false);
        //msg.setClientId("947067763112");
        //msg.setSerialNo(33);
        //msg.setType(288);
        /*message.sequence = Integer.parseInt(UniqueSerialNumberGenerator.getNextSequence()); */// 设置消息序列号，用于消息的顺序管理
        message.packetCount = 0; // 设置分包总数，如果消息体超过1024字节需要分包发送
        message.packetIndex = 0; // 设置分包索引，表示当前分包的序号
        message.id=0x8201;
        Packet p = Packet.create(0);
        message.body=p.getBytes();
        return bytesToHexString(JTT808Encoder.encode(message));
    }

    @Override
    public String generateMessage(JTT808Message message, Jt808CentralControlConfig config) {
        return "";
    }

    @Override
    public String generateMessage(JTT808Message message, ModbusParams params) {
        return "";
    }

    @Override
    public String getType() {
        return MessageType.QUERY_LOCATION.name();
    }
}
